Change in openvpn[master]: clang-format: Switch to ColumnLimit 0
A message that is not in the archive (sent off-list or not yet received): gerrit.1754322460000.Ibd900adfc775b7f785f1d5630184a124f5d8ff4b@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1129?usp=email
to review the following change.
Change subject: clang-format: Switch to ColumnLimit 0
......................................................................
clang-format: Switch to ColumnLimit 0
In some cases an actual ColumnLimit leads to unfortunate formatting. So leave the decision to developers after all.
This commit contains:
- changes that clang-format did as reaction to the config change
- manual cleanups of these changes
- manual cleanup of some previous changes done with ColumnLimit 100
---
M .clang-format
M sample/sample-plugins/client-connect/sample-client-connect.c M sample/sample-plugins/log/log_v3.c
M sample/sample-plugins/simple/base64.c
M src/openvpn/crypto_openssl.c
M src/openvpn/errlevel.h
M src/openvpn/error.c
M src/openvpn/mtu.c
M src/openvpn/multi.c
M src/openvpn/ntlm.c
M src/openvpn/openvpn.c
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/options_util.c
M src/openvpn/run_command.h
M src/openvpn/ssl_common.h
M src/openvpn/xkey_helper.c
M src/tapctl/tap.c
M tests/unit_tests/openvpn/test_pkt.c
19 files changed, 149 insertions(+), 152 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/29/1129/1
.clang-format +1 -1
@@ -24,7 +24,7 @@ BreakBeforeBraces: Allman BreakBeforeTernaryOperators: true BreakStringLiterals: false -ColumnLimit: '100' +ColumnLimit: '0' ContinuationIndentWidth: '4' DerivePointerAlignment: false IndentCaseLabels: true
sample/sample-plugins/client-connect/sample-client-connect.c +2 -3
@@ -128,9 +128,8 @@/* Check API compatibility -- struct version 5 or higher needed */ if (v3structver <5 ) { -fprintf ( - stderr, -"sample-client-connect: this plugin is incompatible with the running version of OpenVPN\n" ); +fprintf (stderr, +"sample-client-connect: this plugin is incompatible with the running version of OpenVPN\n" );return OPENVPN_PLUGIN_FUNC_ERROR ; }
sample/sample-plugins/log/log_v3.c +1 -2
@@ -80,8 +80,7 @@/* Check that we are API compatible */ if (v3structver != OPENVPN_PLUGINv3_STRUCTVER) { -printf ( -"log_v3: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n" ); +printf ("log_v3: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n" );return OPENVPN_PLUGIN_FUNC_ERROR ; }
sample/sample-plugins/simple/base64.c +1 -2
@@ -104,8 +104,7 @@/* Check that we are API compatible */ if (v3structver != OPENVPN_PLUGINv3_STRUCTVER) { -printf ( -"base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n" ); +printf ("base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n" );return OPENVPN_PLUGIN_FUNC_ERROR ; }
src/openvpn/crypto_openssl.c +10 -5
@@ -1046,11 +1046,16 @@* this translation table for forward lookup, only for returning the name * with md_kt_name() */ const cipher_name_pair digest_name_translation_table[] = { - {"BLAKE2s256" ,"BLAKE2S-256" }, {"BLAKE2b512" ,"BLAKE2B-512" }, - {"RIPEMD160" ,"RIPEMD-160" }, {"SHA224" ,"SHA2-224" }, - {"SHA256" ,"SHA2-256" }, {"SHA384" ,"SHA2-384" }, - {"SHA512" ,"SHA2-512" }, {"SHA512-224" ,"SHA2-512/224" }, - {"SHA512-256" ,"SHA2-512/256" }, {"SHAKE128" ,"SHAKE-128" }, + {"BLAKE2s256" ,"BLAKE2S-256" }, + {"BLAKE2b512" ,"BLAKE2B-512" }, + {"RIPEMD160" ,"RIPEMD-160" }, + {"SHA224" ,"SHA2-224" }, + {"SHA256" ,"SHA2-256" }, + {"SHA384" ,"SHA2-384" }, + {"SHA512" ,"SHA2-512" }, + {"SHA512-224" ,"SHA2-512/224" }, + {"SHA512-256" ,"SHA2-512/256" }, + {"SHAKE128" ,"SHAKE-128" }, {"SHAKE256" ,"SHAKE-256" }, }; const size_t digest_name_translation_table_count =
src/openvpn/errlevel.h +82 -82
187 lines not on this page · raw message
src/openvpn/error.c +1 -1
@@ -175,7 +175,7 @@ {openvpn_exit (OPENVPN_EXIT_STATUS_CANNOT_OPEN_DEBUG_FILE );/* exit point */ } -#else /* ifdef OPENVPN_DEBUG_COMMAND_LINE */ +#else msgfp =NULL ;#endif }
src/openvpn/mtu.c +1 -1
@@ -266,7 +266,7 @@ return IP_PMTUDISC_DONT; }msg (M_FATAL ,"invalid --mtu-disc type: '%s' -- valid types are 'yes', 'maybe', or 'no'" , name); -#else /* if defined(IP_PMTUDISC_DONT) && defined(IP_PMTUDISC_WANT) && defined(IP_PMTUDISC_DO) */ +#else msg (M_FATAL ,MTUDISC_NOT_SUPPORTED_MSG );#endif return -1 ;/* NOTREACHED */
src/openvpn/multi.c +1 -3
@@ -1006,9 +1006,7 @@#ifdef PACKET_TRUNCATION_CHECK { -status_printf ( - so, -"HEADER,ERRORS,Common Name,TUN Read Trunc,TUN Write Trunc,Pre-encrypt Trunc,Post-decrypt Trunc" ); +status_printf (so,"HEADER,ERRORS,Common Name,TUN Read Trunc,TUN Write Trunc,Pre-encrypt Trunc,Post-decrypt Trunc" );hash_iterator_init (m->hash, &hi);while ((he =hash_iterator_next (&hi))) {
src/openvpn/ntlm.c +1 -1
@@ -208,7 +208,7 @@uint8_t ntlmv2_hmacmd5[16 ];uint8_t *ntlmv2_blob = ntlmv2_response +16 ;/* inside ntlmv2_response, length: 128 */ int ntlmv2_blob_size =0 ; -int phase3_bufpos =0x40 ;/* offset to next security buffer data to be added */ +int phase3_bufpos =0x40 ;/* offset to next security buffer data to be added */ size_t len;char domain[128 ];
src/openvpn/openvpn.c +1 -3
@@ -160,9 +160,7 @@struct context c;#if PEDANTIC -fprintf ( - stderr, -"Sorry, I was built with --enable-pedantic and I am incapable of doing any real work!\n" ); +fprintf (stderr,"Sorry, I was built with --enable-pedantic and I am incapable of doing any real work!\n" );return 1 ;#endif
src/openvpn/options.c +3 -2
@@ -3931,7 +3931,8 @@* Check file/directory sanity * */ -#ifndef ENABLE_SMALL /* Expect people using the stripped down version to know what they do */ +/* Expect people using the stripped down version to know what they do */ +#ifndef ENABLE_SMALL #define CHKACC_FILE (1 << 0)/**< Check for a file/directory presence */ #define CHKACC_DIRPATH (1 << 1)/**< Check for directory presence where a file should reside */
@@ -6243,7 +6244,7 @@print_default_gateway (M_INFO , &rgi, &rgi6);openvpn_exit (OPENVPN_EXIT_STATUS_GOOD );/* exit point */ } -#endif /* if defined(ENABLE_DEBUG) && !defined(ENABLE_SMALL) */ +#endif else if (streq(p[0], "echo") || streq(p[0], "parameter")) {struct buffer string =alloc_buf_gc (OPTION_PARM_SIZE , &gc);
src/openvpn/options.h +9 -9
@@ -133,16 +133,16 @@int tls_mtu;/* Maximum MTU for the control channel messages */ /* Advanced MTU negotiation and datagram fragmentation options */ -int mtu_discover_type;/* used if OS supports setting Path MTU discovery options on socket */ +int mtu_discover_type;/* used if OS supports setting Path MTU discovery options on socket */ -int fragment;/* internal fragmentation size */ -bool fragment_encap;/* true if --fragment had the "mtu" parameter to -* include overhead from IP and TCP/UDP encapsulation */ -int mssfix;/* Upper bound on TCP MSS */ -bool mssfix_default;/* true if --mssfix should use the default parameters */ -bool mssfix_encap;/* true if --mssfix had the "mtu" parameter to include -* overhead from IP and TCP/UDP encapsulation */ -bool mssfix_fixed;/* use the mssfix value without any encapsulation adjustments */ +int fragment;/* internal fragmentation size */ +bool fragment_encap;/* true if --fragment had the "mtu" parameter to +* include overhead from IP and TCP/UDP encapsulation */ +int mssfix;/* Upper bound on TCP MSS */ +bool mssfix_default;/* true if --mssfix should use the default parameters */ +bool mssfix_encap;/* true if --mssfix had the "mtu" parameter to include +* overhead from IP and TCP/UDP encapsulation */ +bool mssfix_fixed;/* use the mssfix value without any encapsulation adjustments */ int explicit_exit_notification;/* Explicitly tell peer when we are exiting via OCC_EXIT or [RESTART] message */
src/openvpn/options_util.c +7 -7
@@ -146,14 +146,14 @@return (int )i; } -static const char *updatable_options[] = {"block-ipv6" ,"block-outside-dns" , -"dhcp-option" ,"dns" , -"ifconfig" ,"ifconfig-ipv6" , +static const char *updatable_options[] = {"block-ipv6" ,"block-outside-dns" , +"dhcp-option" ,"dns" , +"ifconfig" ,"ifconfig-ipv6" ,"push-continuation" ,"redirect-gateway" , -"redirect-private" ,"route" , -"route-gateway" ,"route-ipv6" , -"route-metric" ,"topology" , -"tun-mtu" ,"keepalive" }; +"redirect-private" ,"route" , +"route-gateway" ,"route-ipv6" , +"route-metric" ,"topology" , +"tun-mtu" ,"keepalive" };bool check_push_update_option_flags (char *line,int *i,unsigned int *flags)
src/openvpn/run_command.h +9 -6
@@ -27,12 +27,15 @@#include "env_set.h" /* Script security */ -#define SSEC_NONE 0/* strictly no calling of external programs */ -#define SSEC_BUILT_IN 1/* only call built-in programs such as ifconfig, route, netsh, etc.*/ -#define SSEC_SCRIPTS 2/* allow calling of built-in programs and user-defined scripts */ -#define SSEC_PW_ENV \ - 3/* allow calling of built-in programs and user-defined scripts that may receive a password \ -as an environmental variable */ +/** strictly no calling of external programs */ +#define SSEC_NONE 0 +/** only call built-in programs such as ifconfig, route, netsh, etc.*/ +#define SSEC_BUILT_IN 1 +/** allow calling of built-in programs and user-defined scripts */ +#define SSEC_SCRIPTS 2 +/** allow calling of built-in programs and user-defined scripts that may receive a password +as an environmental variable */ +#define SSEC_PW_ENV 3#define OPENVPN_EXECVE_ERROR -1/* generic error while forking to run an external program */ #define OPENVPN_EXECVE_NOT_ALLOWED -2/* external program not run due to script security */
src/openvpn/ssl_common.h +9 -10
@@ -222,15 +222,15 @@*/ uint32_t peer_id; -struct key_state_ssl ks_ssl;/* contains SSL object and BIOs for the control channel */ +struct key_state_ssl ks_ssl;/* contains SSL object and BIOs for the control channel */ -time_t initial;/* when we created this session */ -time_t established;/* when our state went S_ACTIVE */ -time_t must_negotiate;/* key negotiation times out if not finished before this time */ -time_t must_die;/* this object is destroyed at this time */ -time_t peer_last_packet;/* Last time we received a packet in this control session */ +time_t initial;/* when we created this session */ +time_t established;/* when our state went S_ACTIVE */ +time_t must_negotiate;/* key negotiation times out if not finished before this time */ +time_t must_die;/* this object is destroyed at this time */ +time_t peer_last_packet;/* Last time we received a packet in this control session */ -int initial_opcode;/* our initial P_ opcode */ +int initial_opcode;/* our initial P_ opcode */ struct session_id session_id_remote;/* peer's random session ID */ struct link_socket_actual remote_addr;/* peer's IP addr */
@@ -579,9 +579,8 @@enum multi_status {CAS_NOT_CONNECTED , -CAS_WAITING_AUTH ,/**< Initial TLS connection established but deferred auth is not yet finished -*/ -CAS_PENDING ,/**< Options import (Connect script/plugin, ccd,...) */ +CAS_WAITING_AUTH ,/**< Initial TLS connection established but deferred auth is not yet finished */ +CAS_PENDING ,/**< Options import (Connect script/plugin, ccd,...) */ CAS_PENDING_DEFERRED ,/**< Waiting on an async option import handler */ CAS_PENDING_DEFERRED_PARTIAL ,/**< at least handler succeeded but another is still pending */ CAS_FAILED ,/**< Option import failed or explicitly denied the client */
src/openvpn/xkey_helper.c +2 -0
@@ -329,10 +329,12 @@#define MAKE_DI (x) { NID_##x, x, sizeof(x) } +/* clang-format off */ DIG_INFO dinfo[] = {MAKE_DI (sha1),MAKE_DI (sha256),MAKE_DI (sha384),MAKE_DI (sha512),MAKE_DI (sha224),MAKE_DI (sha512_224),MAKE_DI (sha512_256), {0 ,NULL ,0 } }; +/* clang-format on */ size_t out_len =0 ;bool ret = false;
src/tapctl/tap.c +6 -12
@@ -225,10 +225,8 @@ delete_device(_In_ HDEVINFO hDeviceInfoSet, _In_ PSP_DEVINFO_DATA pDeviceInfoData, _Inout_ LPBOOL pbRebootRequired) { -SP_REMOVEDEVICE_PARAMS params = - { - .ClassInstallHeader = - { +SP_REMOVEDEVICE_PARAMS params = { + .ClassInstallHeader = { .cbSize =sizeof (SP_CLASSINSTALL_HEADER ), .InstallFunction =DIF_REMOVE , },
@@ -281,10 +279,8 @@ change_device_state(_In_ HDEVINFO hDeviceInfoSet, _In_ PSP_DEVINFO_DATA pDeviceInfoData, _In_ BOOL bEnable, _Inout_ LPBOOL pbRebootRequired) { -SP_PROPCHANGE_PARAMS params = - { - .ClassInstallHeader = - { +SP_PROPCHANGE_PARAMS params = { + .ClassInstallHeader = { .cbSize =sizeof (SP_CLASSINSTALL_HEADER ), .InstallFunction =DIF_PROPERTYCHANGE , },
@@ -768,10 +764,8 @@if (dwResult !=ERROR_SUCCESS ) {/* The adapter was installed. But, the adapter ID was unobtainable. Clean-up. */ -SP_REMOVEDEVICE_PARAMS removedevice_params = - { - .ClassInstallHeader = - { +SP_REMOVEDEVICE_PARAMS removedevice_params = { + .ClassInstallHeader = { .cbSize =sizeof (SP_CLASSINSTALL_HEADER ), .InstallFunction =DIF_REMOVE , },
tests/unit_tests/openvpn/test_pkt.c +2 -2
@@ -219,7 +219,7 @@ {buf_reset_len (&buf);buf_write (&buf, client_reset_v2_tls_crypt,sizeof (client_reset_v2_tls_crypt)); -BPTR (&buf)[i] =0x23 ; + (BPTR (&buf))[i] =0x23 ; verdict =tls_pre_decrypt_lite (&tas, &state, &from, &buf);assert_int_equal (verdict,VERDICT_INVALID );free_tls_pre_decrypt_state (&state);
@@ -274,7 +274,7 @@free_tls_pre_decrypt_state (&state);/* flip a byte in the hmac */ -BPTR (&buf)[20 ] =0x23 ; + (BPTR (&buf))[20 ] =0x23 ; verdict =tls_pre_decrypt_lite (&tas, &state, &from, &buf);assert_int_equal (verdict,VERDICT_INVALID );free_tls_pre_decrypt_state (&state);
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1129?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ibd900adfc775b7f785f1d5630184a124f5d8ff4b
Gerrit-Change-Number: 1129
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: cron2, flichtenheld, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1129?usp=email )
Change subject: clang-format: Switch to ColumnLimit 0
......................................................................
Patch Set 1: Code-Review+2
Copied votes on follow-up patch sets have been updated:
* Code-Review+2 has been copied to patch set 2 (copy condition: "changekind:NO_CHANGE OR changekind:TRIVIAL_REBASE OR is:MIN").
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1129?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ibd900adfc775b7f785f1d5630184a124f5d8ff4b
Gerrit-Change-Number: 1129
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 05 Aug 2025 13:26:51 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v2 1/1 clang-format: Switch to ColumnLimit 0
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
In some cases an actual ColumnLimit leads to unfortunate formatting. So leave the decision to developers after all.
This commit contains:
- changes that clang-format did as reaction to the config change
- manual cleanups of these changes
- manual cleanup of some previous changes done with ColumnLimit 100
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1129
This mail reflects revision 2 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
.clang-format +1 -1
@@ -24,7 +24,7 @@ BreakBeforeBraces: Allman BreakBeforeTernaryOperators: true BreakStringLiterals: false -ColumnLimit: '100' +ColumnLimit: '0' ContinuationIndentWidth: '4' DerivePointerAlignment: false IndentCaseLabels: true
sample/sample-plugins/client-connect/sample-client-connect.c +2 -3
@@ -128,9 +128,8 @@/* Check API compatibility -- struct version 5 or higher needed */ if (v3structver <5 ) { -fprintf ( - stderr, -"sample-client-connect: this plugin is incompatible with the running version of OpenVPN\n" ); +fprintf (stderr, +"sample-client-connect: this plugin is incompatible with the running version of OpenVPN\n" );return OPENVPN_PLUGIN_FUNC_ERROR ; }
sample/sample-plugins/log/log_v3.c +1 -2
@@ -80,8 +80,7 @@/* Check that we are API compatible */ if (v3structver != OPENVPN_PLUGINv3_STRUCTVER) { -printf ( -"log_v3: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n" ); +printf ("log_v3: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n" );return OPENVPN_PLUGIN_FUNC_ERROR ; }
sample/sample-plugins/simple/base64.c +1 -2
@@ -104,8 +104,7 @@/* Check that we are API compatible */ if (v3structver != OPENVPN_PLUGINv3_STRUCTVER) { -printf ( -"base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n" ); +printf ("base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n" );return OPENVPN_PLUGIN_FUNC_ERROR ; }
src/openvpn/crypto_openssl.c +10 -5
@@ -1046,11 +1046,16 @@* this translation table for forward lookup, only for returning the name * with md_kt_name() */ const cipher_name_pair digest_name_translation_table[] = { - {"BLAKE2s256" ,"BLAKE2S-256" }, {"BLAKE2b512" ,"BLAKE2B-512" }, - {"RIPEMD160" ,"RIPEMD-160" }, {"SHA224" ,"SHA2-224" }, - {"SHA256" ,"SHA2-256" }, {"SHA384" ,"SHA2-384" }, - {"SHA512" ,"SHA2-512" }, {"SHA512-224" ,"SHA2-512/224" }, - {"SHA512-256" ,"SHA2-512/256" }, {"SHAKE128" ,"SHAKE-128" }, + {"BLAKE2s256" ,"BLAKE2S-256" }, + {"BLAKE2b512" ,"BLAKE2B-512" }, + {"RIPEMD160" ,"RIPEMD-160" }, + {"SHA224" ,"SHA2-224" }, + {"SHA256" ,"SHA2-256" }, + {"SHA384" ,"SHA2-384" }, + {"SHA512" ,"SHA2-512" }, + {"SHA512-224" ,"SHA2-512/224" }, + {"SHA512-256" ,"SHA2-512/256" }, + {"SHAKE128" ,"SHAKE-128" }, {"SHAKE256" ,"SHAKE-256" }, }; const size_t digest_name_translation_table_count =
src/openvpn/errlevel.h +82 -82
187 lines not on this page · raw message
src/openvpn/error.c +1 -1
@@ -175,7 +175,7 @@ {openvpn_exit (OPENVPN_EXIT_STATUS_CANNOT_OPEN_DEBUG_FILE );/* exit point */ } -#else /* ifdef OPENVPN_DEBUG_COMMAND_LINE */ +#else msgfp =NULL ;#endif }
src/openvpn/mtu.c +1 -1
@@ -266,7 +266,7 @@ return IP_PMTUDISC_DONT; }msg (M_FATAL ,"invalid --mtu-disc type: '%s' -- valid types are 'yes', 'maybe', or 'no'" , name); -#else /* if defined(IP_PMTUDISC_DONT) && defined(IP_PMTUDISC_WANT) && defined(IP_PMTUDISC_DO) */ +#else msg (M_FATAL ,MTUDISC_NOT_SUPPORTED_MSG );#endif return -1 ;/* NOTREACHED */
src/openvpn/multi.c +1 -3
@@ -1006,9 +1006,7 @@#ifdef PACKET_TRUNCATION_CHECK { -status_printf ( - so, -"HEADER,ERRORS,Common Name,TUN Read Trunc,TUN Write Trunc,Pre-encrypt Trunc,Post-decrypt Trunc" ); +status_printf (so,"HEADER,ERRORS,Common Name,TUN Read Trunc,TUN Write Trunc,Pre-encrypt Trunc,Post-decrypt Trunc" );hash_iterator_init (m->hash, &hi);while ((he =hash_iterator_next (&hi))) {
src/openvpn/ntlm.c +1 -1
@@ -208,7 +208,7 @@uint8_t ntlmv2_hmacmd5[16 ];uint8_t *ntlmv2_blob = ntlmv2_response +16 ;/* inside ntlmv2_response, length: 128 */ int ntlmv2_blob_size =0 ; -int phase3_bufpos =0x40 ;/* offset to next security buffer data to be added */ +int phase3_bufpos =0x40 ;/* offset to next security buffer data to be added */ size_t len;char domain[128 ];
src/openvpn/openvpn.c +1 -3
@@ -160,9 +160,7 @@struct context c;#if PEDANTIC -fprintf ( - stderr, -"Sorry, I was built with --enable-pedantic and I am incapable of doing any real work!\n" ); +fprintf (stderr,"Sorry, I was built with --enable-pedantic and I am incapable of doing any real work!\n" );return 1 ;#endif
src/openvpn/options.c +3 -2
@@ -3931,7 +3931,8 @@* Check file/directory sanity * */ -#ifndef ENABLE_SMALL /* Expect people using the stripped down version to know what they do */ +/* Expect people using the stripped down version to know what they do */ +#ifndef ENABLE_SMALL #define CHKACC_FILE (1 << 0)/**< Check for a file/directory presence */ #define CHKACC_DIRPATH (1 << 1)/**< Check for directory presence where a file should reside */
@@ -6243,7 +6244,7 @@print_default_gateway (M_INFO , &rgi, &rgi6);openvpn_exit (OPENVPN_EXIT_STATUS_GOOD );/* exit point */ } -#endif /* if defined(ENABLE_DEBUG) && !defined(ENABLE_SMALL) */ +#endif else if (streq(p[0], "echo") || streq(p[0], "parameter")) {struct buffer string =alloc_buf_gc (OPTION_PARM_SIZE , &gc);
src/openvpn/options.h +9 -9
@@ -133,16 +133,16 @@int tls_mtu;/* Maximum MTU for the control channel messages */ /* Advanced MTU negotiation and datagram fragmentation options */ -int mtu_discover_type;/* used if OS supports setting Path MTU discovery options on socket */ +int mtu_discover_type;/* used if OS supports setting Path MTU discovery options on socket */ -int fragment;/* internal fragmentation size */ -bool fragment_encap;/* true if --fragment had the "mtu" parameter to -* include overhead from IP and TCP/UDP encapsulation */ -int mssfix;/* Upper bound on TCP MSS */ -bool mssfix_default;/* true if --mssfix should use the default parameters */ -bool mssfix_encap;/* true if --mssfix had the "mtu" parameter to include -* overhead from IP and TCP/UDP encapsulation */ -bool mssfix_fixed;/* use the mssfix value without any encapsulation adjustments */ +int fragment;/* internal fragmentation size */ +bool fragment_encap;/* true if --fragment had the "mtu" parameter to +* include overhead from IP and TCP/UDP encapsulation */ +int mssfix;/* Upper bound on TCP MSS */ +bool mssfix_default;/* true if --mssfix should use the default parameters */ +bool mssfix_encap;/* true if --mssfix had the "mtu" parameter to include +* overhead from IP and TCP/UDP encapsulation */ +bool mssfix_fixed;/* use the mssfix value without any encapsulation adjustments */ int explicit_exit_notification;/* Explicitly tell peer when we are exiting via OCC_EXIT or [RESTART] message */
src/openvpn/options_util.c +7 -7
@@ -146,14 +146,14 @@return (int )i; } -static const char *updatable_options[] = {"block-ipv6" ,"block-outside-dns" , -"dhcp-option" ,"dns" , -"ifconfig" ,"ifconfig-ipv6" , +static const char *updatable_options[] = {"block-ipv6" ,"block-outside-dns" , +"dhcp-option" ,"dns" , +"ifconfig" ,"ifconfig-ipv6" ,"push-continuation" ,"redirect-gateway" , -"redirect-private" ,"route" , -"route-gateway" ,"route-ipv6" , -"route-metric" ,"topology" , -"tun-mtu" ,"keepalive" }; +"redirect-private" ,"route" , +"route-gateway" ,"route-ipv6" , +"route-metric" ,"topology" , +"tun-mtu" ,"keepalive" };bool check_push_update_option_flags (char *line,int *i,unsigned int *flags)
src/openvpn/run_command.h +9 -6
@@ -27,12 +27,15 @@#include "env_set.h" /* Script security */ -#define SSEC_NONE 0/* strictly no calling of external programs */ -#define SSEC_BUILT_IN 1/* only call built-in programs such as ifconfig, route, netsh, etc.*/ -#define SSEC_SCRIPTS 2/* allow calling of built-in programs and user-defined scripts */ -#define SSEC_PW_ENV \ - 3/* allow calling of built-in programs and user-defined scripts that may receive a password \ -as an environmental variable */ +/** strictly no calling of external programs */ +#define SSEC_NONE 0 +/** only call built-in programs such as ifconfig, route, netsh, etc.*/ +#define SSEC_BUILT_IN 1 +/** allow calling of built-in programs and user-defined scripts */ +#define SSEC_SCRIPTS 2 +/** allow calling of built-in programs and user-defined scripts that may receive a password +as an environmental variable */ +#define SSEC_PW_ENV 3#define OPENVPN_EXECVE_ERROR -1/* generic error while forking to run an external program */ #define OPENVPN_EXECVE_NOT_ALLOWED -2/* external program not run due to script security */
src/openvpn/ssl_common.h +9 -10
@@ -222,15 +222,15 @@*/ uint32_t peer_id; -struct key_state_ssl ks_ssl;/* contains SSL object and BIOs for the control channel */ +struct key_state_ssl ks_ssl;/* contains SSL object and BIOs for the control channel */ -time_t initial;/* when we created this session */ -time_t established;/* when our state went S_ACTIVE */ -time_t must_negotiate;/* key negotiation times out if not finished before this time */ -time_t must_die;/* this object is destroyed at this time */ -time_t peer_last_packet;/* Last time we received a packet in this control session */ +time_t initial;/* when we created this session */ +time_t established;/* when our state went S_ACTIVE */ +time_t must_negotiate;/* key negotiation times out if not finished before this time */ +time_t must_die;/* this object is destroyed at this time */ +time_t peer_last_packet;/* Last time we received a packet in this control session */ -int initial_opcode;/* our initial P_ opcode */ +int initial_opcode;/* our initial P_ opcode */ struct session_id session_id_remote;/* peer's random session ID */ struct link_socket_actual remote_addr;/* peer's IP addr */
@@ -579,9 +579,8 @@enum multi_status {CAS_NOT_CONNECTED , -CAS_WAITING_AUTH ,/**< Initial TLS connection established but deferred auth is not yet finished -*/ -CAS_PENDING ,/**< Options import (Connect script/plugin, ccd,...) */ +CAS_WAITING_AUTH ,/**< Initial TLS connection established but deferred auth is not yet finished */ +CAS_PENDING ,/**< Options import (Connect script/plugin, ccd,...) */ CAS_PENDING_DEFERRED ,/**< Waiting on an async option import handler */ CAS_PENDING_DEFERRED_PARTIAL ,/**< at least handler succeeded but another is still pending */ CAS_FAILED ,/**< Option import failed or explicitly denied the client */
src/openvpn/xkey_helper.c +2 -0
@@ -329,10 +329,12 @@#define MAKE_DI (x) { NID_##x, x, sizeof(x) } +/* clang-format off */ DIG_INFO dinfo[] = {MAKE_DI (sha1),MAKE_DI (sha256),MAKE_DI (sha384),MAKE_DI (sha512),MAKE_DI (sha224),MAKE_DI (sha512_224),MAKE_DI (sha512_256), {0 ,NULL ,0 } }; +/* clang-format on */ size_t out_len =0 ;bool ret = false;
src/tapctl/tap.c +6 -12
@@ -225,10 +225,8 @@ delete_device(_In_ HDEVINFO hDeviceInfoSet, _In_ PSP_DEVINFO_DATA pDeviceInfoData, _Inout_ LPBOOL pbRebootRequired) { -SP_REMOVEDEVICE_PARAMS params = - { - .ClassInstallHeader = - { +SP_REMOVEDEVICE_PARAMS params = { + .ClassInstallHeader = { .cbSize =sizeof (SP_CLASSINSTALL_HEADER ), .InstallFunction =DIF_REMOVE , },
@@ -281,10 +279,8 @@ change_device_state(_In_ HDEVINFO hDeviceInfoSet, _In_ PSP_DEVINFO_DATA pDeviceInfoData, _In_ BOOL bEnable, _Inout_ LPBOOL pbRebootRequired) { -SP_PROPCHANGE_PARAMS params = - { - .ClassInstallHeader = - { +SP_PROPCHANGE_PARAMS params = { + .ClassInstallHeader = { .cbSize =sizeof (SP_CLASSINSTALL_HEADER ), .InstallFunction =DIF_PROPERTYCHANGE , },
@@ -768,10 +764,8 @@if (dwResult !=ERROR_SUCCESS ) {/* The adapter was installed. But, the adapter ID was unobtainable. Clean-up. */ -SP_REMOVEDEVICE_PARAMS removedevice_params = - { - .ClassInstallHeader = - { +SP_REMOVEDEVICE_PARAMS removedevice_params = { + .ClassInstallHeader = { .cbSize =sizeof (SP_CLASSINSTALL_HEADER ), .InstallFunction =DIF_REMOVE , },
tests/unit_tests/openvpn/test_pkt.c +2 -2
@@ -219,7 +219,7 @@ {buf_reset_len (&buf);buf_write (&buf, client_reset_v2_tls_crypt,sizeof (client_reset_v2_tls_crypt)); -BPTR (&buf)[i] =0x23 ; + (BPTR (&buf))[i] =0x23 ; verdict =tls_pre_decrypt_lite (&tas, &state, &from, &buf);assert_int_equal (verdict,VERDICT_INVALID );free_tls_pre_decrypt_state (&state);
@@ -274,7 +274,7 @@free_tls_pre_decrypt_state (&state);/* flip a byte in the hmac */ -BPTR (&buf)[20 ] =0x23 ; + (BPTR (&buf))[20 ] =0x23 ; verdict =tls_pre_decrypt_lite (&tas, &state, &from, &buf);assert_int_equal (verdict,VERDICT_INVALID );free_tls_pre_decrypt_state (&state);
[Openvpn-devel] [PATCH applied] Re: clang-format: Switch to ColumnLimit 0
This has been stared-at, and subjected to testing in the client and server testbeds ("you never know").
Some of the changes are slightly non-obvious - one thing we discovered is that clang-format tries really hard to align end-of-line comments, but only if you do not exceed "ColumnLimit". If you do, all these comments get "1 space, only, no matter how much they had before".
So, without the limit, some #endif comments ended up going to column 130-ish, which made the result non helpful - so you see comments disappear now, because the #ifdef/endif clauses were so short that it was obvious.
Also, errlevel.h got re-aligned now... which is nice, but makes this look much larger.
Your patch has been applied to the master branch.
commit 21f7d6e1ad65b1f7db673bc98764dc7325858e0b
Author: Frank Lichtenheld Date: Tue Aug 5 15:27:01 2025 +0200
clang-format: Switch to ColumnLimit 0
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32523.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Attention is currently required from: cron2.
cron2 has uploaded a new patch set (#3) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1129?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: clang-format: Switch to ColumnLimit 0
......................................................................
clang-format: Switch to ColumnLimit 0
In some cases an actual ColumnLimit leads to unfortunate formatting. So leave the decision to developers after all.
This commit contains:
- changes that clang-format did as reaction to the config change
- manual cleanups of these changes
- manual cleanup of some previous changes done with ColumnLimit 100
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32523.html
---
M .clang-format
M sample/sample-plugins/client-connect/sample-client-connect.c M sample/sample-plugins/log/log_v3.c
M sample/sample-plugins/simple/base64.c
M src/openvpn/crypto_openssl.c
M src/openvpn/errlevel.h
M src/openvpn/error.c
M src/openvpn/mtu.c
M src/openvpn/multi.c
M src/openvpn/ntlm.c
M src/openvpn/openvpn.c
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/options_util.c
M src/openvpn/run_command.h
M src/openvpn/ssl_common.h
M src/openvpn/xkey_helper.c
M src/tapctl/tap.c
M tests/unit_tests/openvpn/test_pkt.c
19 files changed, 149 insertions(+), 152 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/29/1129/3
.clang-format +1 -1
@@ -24,7 +24,7 @@ BreakBeforeBraces: Allman BreakBeforeTernaryOperators: true BreakStringLiterals: false -ColumnLimit: '100' +ColumnLimit: '0' ContinuationIndentWidth: '4' DerivePointerAlignment: false IndentCaseLabels: true
sample/sample-plugins/client-connect/sample-client-connect.c +2 -3
@@ -128,9 +128,8 @@/* Check API compatibility -- struct version 5 or higher needed */ if (v3structver <5 ) { -fprintf ( - stderr, -"sample-client-connect: this plugin is incompatible with the running version of OpenVPN\n" ); +fprintf (stderr, +"sample-client-connect: this plugin is incompatible with the running version of OpenVPN\n" );return OPENVPN_PLUGIN_FUNC_ERROR ; }
sample/sample-plugins/log/log_v3.c +1 -2
@@ -80,8 +80,7 @@/* Check that we are API compatible */ if (v3structver != OPENVPN_PLUGINv3_STRUCTVER) { -printf ( -"log_v3: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n" ); +printf ("log_v3: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n" );return OPENVPN_PLUGIN_FUNC_ERROR ; }
sample/sample-plugins/simple/base64.c +1 -2
@@ -104,8 +104,7 @@/* Check that we are API compatible */ if (v3structver != OPENVPN_PLUGINv3_STRUCTVER) { -printf ( -"base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n" ); +printf ("base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n" );return OPENVPN_PLUGIN_FUNC_ERROR ; }
src/openvpn/crypto_openssl.c +10 -5
@@ -1046,11 +1046,16 @@* this translation table for forward lookup, only for returning the name * with md_kt_name() */ const cipher_name_pair digest_name_translation_table[] = { - {"BLAKE2s256" ,"BLAKE2S-256" }, {"BLAKE2b512" ,"BLAKE2B-512" }, - {"RIPEMD160" ,"RIPEMD-160" }, {"SHA224" ,"SHA2-224" }, - {"SHA256" ,"SHA2-256" }, {"SHA384" ,"SHA2-384" }, - {"SHA512" ,"SHA2-512" }, {"SHA512-224" ,"SHA2-512/224" }, - {"SHA512-256" ,"SHA2-512/256" }, {"SHAKE128" ,"SHAKE-128" }, + {"BLAKE2s256" ,"BLAKE2S-256" }, + {"BLAKE2b512" ,"BLAKE2B-512" }, + {"RIPEMD160" ,"RIPEMD-160" }, + {"SHA224" ,"SHA2-224" }, + {"SHA256" ,"SHA2-256" }, + {"SHA384" ,"SHA2-384" }, + {"SHA512" ,"SHA2-512" }, + {"SHA512-224" ,"SHA2-512/224" }, + {"SHA512-256" ,"SHA2-512/256" }, + {"SHAKE128" ,"SHAKE-128" }, {"SHAKE256" ,"SHAKE-256" }, }; const size_t digest_name_translation_table_count =
src/openvpn/errlevel.h +82 -82
187 lines not on this page · raw message
src/openvpn/error.c +1 -1
@@ -175,7 +175,7 @@ {openvpn_exit (OPENVPN_EXIT_STATUS_CANNOT_OPEN_DEBUG_FILE );/* exit point */ } -#else /* ifdef OPENVPN_DEBUG_COMMAND_LINE */ +#else msgfp =NULL ;#endif }
src/openvpn/mtu.c +1 -1
@@ -266,7 +266,7 @@ return IP_PMTUDISC_DONT; }msg (M_FATAL ,"invalid --mtu-disc type: '%s' -- valid types are 'yes', 'maybe', or 'no'" , name); -#else /* if defined(IP_PMTUDISC_DONT) && defined(IP_PMTUDISC_WANT) && defined(IP_PMTUDISC_DO) */ +#else msg (M_FATAL ,MTUDISC_NOT_SUPPORTED_MSG );#endif return -1 ;/* NOTREACHED */
src/openvpn/multi.c +1 -3
@@ -1006,9 +1006,7 @@#ifdef PACKET_TRUNCATION_CHECK { -status_printf ( - so, -"HEADER,ERRORS,Common Name,TUN Read Trunc,TUN Write Trunc,Pre-encrypt Trunc,Post-decrypt Trunc" ); +status_printf (so,"HEADER,ERRORS,Common Name,TUN Read Trunc,TUN Write Trunc,Pre-encrypt Trunc,Post-decrypt Trunc" );hash_iterator_init (m->hash, &hi);while ((he =hash_iterator_next (&hi))) {
src/openvpn/ntlm.c +1 -1
@@ -208,7 +208,7 @@uint8_t ntlmv2_hmacmd5[16 ];uint8_t *ntlmv2_blob = ntlmv2_response +16 ;/* inside ntlmv2_response, length: 128 */ int ntlmv2_blob_size =0 ; -int phase3_bufpos =0x40 ;/* offset to next security buffer data to be added */ +int phase3_bufpos =0x40 ;/* offset to next security buffer data to be added */ size_t len;char domain[128 ];
src/openvpn/openvpn.c +1 -3
@@ -160,9 +160,7 @@struct context c;#if PEDANTIC -fprintf ( - stderr, -"Sorry, I was built with --enable-pedantic and I am incapable of doing any real work!\n" ); +fprintf (stderr,"Sorry, I was built with --enable-pedantic and I am incapable of doing any real work!\n" );return 1 ;#endif
src/openvpn/options.c +3 -2
@@ -3931,7 +3931,8 @@* Check file/directory sanity * */ -#ifndef ENABLE_SMALL /* Expect people using the stripped down version to know what they do */ +/* Expect people using the stripped down version to know what they do */ +#ifndef ENABLE_SMALL #define CHKACC_FILE (1 << 0)/**< Check for a file/directory presence */ #define CHKACC_DIRPATH (1 << 1)/**< Check for directory presence where a file should reside */
@@ -6243,7 +6244,7 @@print_default_gateway (M_INFO , &rgi, &rgi6);openvpn_exit (OPENVPN_EXIT_STATUS_GOOD );/* exit point */ } -#endif /* if defined(ENABLE_DEBUG) && !defined(ENABLE_SMALL) */ +#endif else if (streq(p[0], "echo") || streq(p[0], "parameter")) {struct buffer string =alloc_buf_gc (OPTION_PARM_SIZE , &gc);
src/openvpn/options.h +9 -9
@@ -133,16 +133,16 @@int tls_mtu;/* Maximum MTU for the control channel messages */ /* Advanced MTU negotiation and datagram fragmentation options */ -int mtu_discover_type;/* used if OS supports setting Path MTU discovery options on socket */ +int mtu_discover_type;/* used if OS supports setting Path MTU discovery options on socket */ -int fragment;/* internal fragmentation size */ -bool fragment_encap;/* true if --fragment had the "mtu" parameter to -* include overhead from IP and TCP/UDP encapsulation */ -int mssfix;/* Upper bound on TCP MSS */ -bool mssfix_default;/* true if --mssfix should use the default parameters */ -bool mssfix_encap;/* true if --mssfix had the "mtu" parameter to include -* overhead from IP and TCP/UDP encapsulation */ -bool mssfix_fixed;/* use the mssfix value without any encapsulation adjustments */ +int fragment;/* internal fragmentation size */ +bool fragment_encap;/* true if --fragment had the "mtu" parameter to +* include overhead from IP and TCP/UDP encapsulation */ +int mssfix;/* Upper bound on TCP MSS */ +bool mssfix_default;/* true if --mssfix should use the default parameters */ +bool mssfix_encap;/* true if --mssfix had the "mtu" parameter to include +* overhead from IP and TCP/UDP encapsulation */ +bool mssfix_fixed;/* use the mssfix value without any encapsulation adjustments */ int explicit_exit_notification;/* Explicitly tell peer when we are exiting via OCC_EXIT or [RESTART] message */
src/openvpn/options_util.c +7 -7
@@ -146,14 +146,14 @@return (int )i; } -static const char *updatable_options[] = {"block-ipv6" ,"block-outside-dns" , -"dhcp-option" ,"dns" , -"ifconfig" ,"ifconfig-ipv6" , +static const char *updatable_options[] = {"block-ipv6" ,"block-outside-dns" , +"dhcp-option" ,"dns" , +"ifconfig" ,"ifconfig-ipv6" ,"push-continuation" ,"redirect-gateway" , -"redirect-private" ,"route" , -"route-gateway" ,"route-ipv6" , -"route-metric" ,"topology" , -"tun-mtu" ,"keepalive" }; +"redirect-private" ,"route" , +"route-gateway" ,"route-ipv6" , +"route-metric" ,"topology" , +"tun-mtu" ,"keepalive" };bool check_push_update_option_flags (char *line,int *i,unsigned int *flags)
src/openvpn/run_command.h +9 -6
@@ -27,12 +27,15 @@#include "env_set.h" /* Script security */ -#define SSEC_NONE 0/* strictly no calling of external programs */ -#define SSEC_BUILT_IN 1/* only call built-in programs such as ifconfig, route, netsh, etc.*/ -#define SSEC_SCRIPTS 2/* allow calling of built-in programs and user-defined scripts */ -#define SSEC_PW_ENV \ - 3/* allow calling of built-in programs and user-defined scripts that may receive a password \ -as an environmental variable */ +/** strictly no calling of external programs */ +#define SSEC_NONE 0 +/** only call built-in programs such as ifconfig, route, netsh, etc.*/ +#define SSEC_BUILT_IN 1 +/** allow calling of built-in programs and user-defined scripts */ +#define SSEC_SCRIPTS 2 +/** allow calling of built-in programs and user-defined scripts that may receive a password +as an environmental variable */ +#define SSEC_PW_ENV 3#define OPENVPN_EXECVE_ERROR -1/* generic error while forking to run an external program */ #define OPENVPN_EXECVE_NOT_ALLOWED -2/* external program not run due to script security */
src/openvpn/ssl_common.h +9 -10
@@ -222,15 +222,15 @@*/ uint32_t peer_id; -struct key_state_ssl ks_ssl;/* contains SSL object and BIOs for the control channel */ +struct key_state_ssl ks_ssl;/* contains SSL object and BIOs for the control channel */ -time_t initial;/* when we created this session */ -time_t established;/* when our state went S_ACTIVE */ -time_t must_negotiate;/* key negotiation times out if not finished before this time */ -time_t must_die;/* this object is destroyed at this time */ -time_t peer_last_packet;/* Last time we received a packet in this control session */ +time_t initial;/* when we created this session */ +time_t established;/* when our state went S_ACTIVE */ +time_t must_negotiate;/* key negotiation times out if not finished before this time */ +time_t must_die;/* this object is destroyed at this time */ +time_t peer_last_packet;/* Last time we received a packet in this control session */ -int initial_opcode;/* our initial P_ opcode */ +int initial_opcode;/* our initial P_ opcode */ struct session_id session_id_remote;/* peer's random session ID */ struct link_socket_actual remote_addr;/* peer's IP addr */
@@ -579,9 +579,8 @@enum multi_status {CAS_NOT_CONNECTED , -CAS_WAITING_AUTH ,/**< Initial TLS connection established but deferred auth is not yet finished -*/ -CAS_PENDING ,/**< Options import (Connect script/plugin, ccd,...) */ +CAS_WAITING_AUTH ,/**< Initial TLS connection established but deferred auth is not yet finished */ +CAS_PENDING ,/**< Options import (Connect script/plugin, ccd,...) */ CAS_PENDING_DEFERRED ,/**< Waiting on an async option import handler */ CAS_PENDING_DEFERRED_PARTIAL ,/**< at least handler succeeded but another is still pending */ CAS_FAILED ,/**< Option import failed or explicitly denied the client */
src/openvpn/xkey_helper.c +2 -0
@@ -329,10 +329,12 @@#define MAKE_DI (x) { NID_##x, x, sizeof(x) } +/* clang-format off */ DIG_INFO dinfo[] = {MAKE_DI (sha1),MAKE_DI (sha256),MAKE_DI (sha384),MAKE_DI (sha512),MAKE_DI (sha224),MAKE_DI (sha512_224),MAKE_DI (sha512_256), {0 ,NULL ,0 } }; +/* clang-format on */ size_t out_len =0 ;bool ret = false;
src/tapctl/tap.c +6 -12
@@ -225,10 +225,8 @@ delete_device(_In_ HDEVINFO hDeviceInfoSet, _In_ PSP_DEVINFO_DATA pDeviceInfoData, _Inout_ LPBOOL pbRebootRequired) { -SP_REMOVEDEVICE_PARAMS params = - { - .ClassInstallHeader = - { +SP_REMOVEDEVICE_PARAMS params = { + .ClassInstallHeader = { .cbSize =sizeof (SP_CLASSINSTALL_HEADER ), .InstallFunction =DIF_REMOVE , },
@@ -281,10 +279,8 @@ change_device_state(_In_ HDEVINFO hDeviceInfoSet, _In_ PSP_DEVINFO_DATA pDeviceInfoData, _In_ BOOL bEnable, _Inout_ LPBOOL pbRebootRequired) { -SP_PROPCHANGE_PARAMS params = - { - .ClassInstallHeader = - { +SP_PROPCHANGE_PARAMS params = { + .ClassInstallHeader = { .cbSize =sizeof (SP_CLASSINSTALL_HEADER ), .InstallFunction =DIF_PROPERTYCHANGE , },
@@ -768,10 +764,8 @@if (dwResult !=ERROR_SUCCESS ) {/* The adapter was installed. But, the adapter ID was unobtainable. Clean-up. */ -SP_REMOVEDEVICE_PARAMS removedevice_params = - { - .ClassInstallHeader = - { +SP_REMOVEDEVICE_PARAMS removedevice_params = { + .ClassInstallHeader = { .cbSize =sizeof (SP_CLASSINSTALL_HEADER ), .InstallFunction =DIF_REMOVE , },
tests/unit_tests/openvpn/test_pkt.c +2 -2
@@ -219,7 +219,7 @@ {buf_reset_len (&buf);buf_write (&buf, client_reset_v2_tls_crypt,sizeof (client_reset_v2_tls_crypt)); -BPTR (&buf)[i] =0x23 ; + (BPTR (&buf))[i] =0x23 ; verdict =tls_pre_decrypt_lite (&tas, &state, &from, &buf);assert_int_equal (verdict,VERDICT_INVALID );free_tls_pre_decrypt_state (&state);
@@ -274,7 +274,7 @@free_tls_pre_decrypt_state (&state);/* flip a byte in the hmac */ -BPTR (&buf)[20 ] =0x23 ; + (BPTR (&buf))[20 ] =0x23 ; verdict =tls_pre_decrypt_lite (&tas, &state, &from, &buf);assert_int_equal (verdict,VERDICT_INVALID );free_tls_pre_decrypt_state (&state);
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1129?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ibd900adfc775b7f785f1d5630184a124f5d8ff4b
Gerrit-Change-Number: 1129
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: cron2.
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1129?usp=email )
Change subject: clang-format: Switch to ColumnLimit 0
......................................................................
clang-format: Switch to ColumnLimit 0
In some cases an actual ColumnLimit leads to unfortunate formatting. So leave the decision to developers after all.
This commit contains:
- changes that clang-format did as reaction to the config change
- manual cleanups of these changes
- manual cleanup of some previous changes done with ColumnLimit 100
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32523.html
---
M .clang-format
M sample/sample-plugins/client-connect/sample-client-connect.c M sample/sample-plugins/log/log_v3.c
M sample/sample-plugins/simple/base64.c
M src/openvpn/crypto_openssl.c
M src/openvpn/errlevel.h
M src/openvpn/error.c
M src/openvpn/mtu.c
M src/openvpn/multi.c
M src/openvpn/ntlm.c
M src/openvpn/openvpn.c
M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/options_util.c
M src/openvpn/run_command.h
M src/openvpn/ssl_common.h
M src/openvpn/xkey_helper.c
M src/tapctl/tap.c
M tests/unit_tests/openvpn/test_pkt.c
19 files changed, 149 insertions(+), 152 deletions(-)
.clang-format +1 -1
@@ -24,7 +24,7 @@ BreakBeforeBraces: Allman BreakBeforeTernaryOperators: true BreakStringLiterals: false -ColumnLimit: '100' +ColumnLimit: '0' ContinuationIndentWidth: '4' DerivePointerAlignment: false IndentCaseLabels: true
sample/sample-plugins/client-connect/sample-client-connect.c +2 -3
@@ -128,9 +128,8 @@/* Check API compatibility -- struct version 5 or higher needed */ if (v3structver <5 ) { -fprintf ( - stderr, -"sample-client-connect: this plugin is incompatible with the running version of OpenVPN\n" ); +fprintf (stderr, +"sample-client-connect: this plugin is incompatible with the running version of OpenVPN\n" );return OPENVPN_PLUGIN_FUNC_ERROR ; }
sample/sample-plugins/log/log_v3.c +1 -2
@@ -80,8 +80,7 @@/* Check that we are API compatible */ if (v3structver != OPENVPN_PLUGINv3_STRUCTVER) { -printf ( -"log_v3: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n" ); +printf ("log_v3: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n" );return OPENVPN_PLUGIN_FUNC_ERROR ; }
sample/sample-plugins/simple/base64.c +1 -2
@@ -104,8 +104,7 @@/* Check that we are API compatible */ if (v3structver != OPENVPN_PLUGINv3_STRUCTVER) { -printf ( -"base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n" ); +printf ("base64.c: ** ERROR ** Incompatible plug-in interface between this plug-in and OpenVPN\n" );return OPENVPN_PLUGIN_FUNC_ERROR ; }
src/openvpn/crypto_openssl.c +10 -5
@@ -1046,11 +1046,16 @@* this translation table for forward lookup, only for returning the name * with md_kt_name() */ const cipher_name_pair digest_name_translation_table[] = { - {"BLAKE2s256" ,"BLAKE2S-256" }, {"BLAKE2b512" ,"BLAKE2B-512" }, - {"RIPEMD160" ,"RIPEMD-160" }, {"SHA224" ,"SHA2-224" }, - {"SHA256" ,"SHA2-256" }, {"SHA384" ,"SHA2-384" }, - {"SHA512" ,"SHA2-512" }, {"SHA512-224" ,"SHA2-512/224" }, - {"SHA512-256" ,"SHA2-512/256" }, {"SHAKE128" ,"SHAKE-128" }, + {"BLAKE2s256" ,"BLAKE2S-256" }, + {"BLAKE2b512" ,"BLAKE2B-512" }, + {"RIPEMD160" ,"RIPEMD-160" }, + {"SHA224" ,"SHA2-224" }, + {"SHA256" ,"SHA2-256" }, + {"SHA384" ,"SHA2-384" }, + {"SHA512" ,"SHA2-512" }, + {"SHA512-224" ,"SHA2-512/224" }, + {"SHA512-256" ,"SHA2-512/256" }, + {"SHAKE128" ,"SHAKE-128" }, {"SHAKE256" ,"SHAKE-256" }, }; const size_t digest_name_translation_table_count =
src/openvpn/errlevel.h +82 -82
187 lines not on this page · raw message
src/openvpn/error.c +1 -1
@@ -175,7 +175,7 @@ {openvpn_exit (OPENVPN_EXIT_STATUS_CANNOT_OPEN_DEBUG_FILE );/* exit point */ } -#else /* ifdef OPENVPN_DEBUG_COMMAND_LINE */ +#else msgfp =NULL ;#endif }
src/openvpn/mtu.c +1 -1
@@ -266,7 +266,7 @@ return IP_PMTUDISC_DONT; }msg (M_FATAL ,"invalid --mtu-disc type: '%s' -- valid types are 'yes', 'maybe', or 'no'" , name); -#else /* if defined(IP_PMTUDISC_DONT) && defined(IP_PMTUDISC_WANT) && defined(IP_PMTUDISC_DO) */ +#else msg (M_FATAL ,MTUDISC_NOT_SUPPORTED_MSG );#endif return -1 ;/* NOTREACHED */
src/openvpn/multi.c +1 -3
@@ -1006,9 +1006,7 @@#ifdef PACKET_TRUNCATION_CHECK { -status_printf ( - so, -"HEADER,ERRORS,Common Name,TUN Read Trunc,TUN Write Trunc,Pre-encrypt Trunc,Post-decrypt Trunc" ); +status_printf (so,"HEADER,ERRORS,Common Name,TUN Read Trunc,TUN Write Trunc,Pre-encrypt Trunc,Post-decrypt Trunc" );hash_iterator_init (m->hash, &hi);while ((he =hash_iterator_next (&hi))) {
src/openvpn/ntlm.c +1 -1
@@ -208,7 +208,7 @@uint8_t ntlmv2_hmacmd5[16 ];uint8_t *ntlmv2_blob = ntlmv2_response +16 ;/* inside ntlmv2_response, length: 128 */ int ntlmv2_blob_size =0 ; -int phase3_bufpos =0x40 ;/* offset to next security buffer data to be added */ +int phase3_bufpos =0x40 ;/* offset to next security buffer data to be added */ size_t len;char domain[128 ];
src/openvpn/openvpn.c +1 -3
@@ -160,9 +160,7 @@struct context c;#if PEDANTIC -fprintf ( - stderr, -"Sorry, I was built with --enable-pedantic and I am incapable of doing any real work!\n" ); +fprintf (stderr,"Sorry, I was built with --enable-pedantic and I am incapable of doing any real work!\n" );return 1 ;#endif
src/openvpn/options.c +3 -2
@@ -3931,7 +3931,8 @@* Check file/directory sanity * */ -#ifndef ENABLE_SMALL /* Expect people using the stripped down version to know what they do */ +/* Expect people using the stripped down version to know what they do */ +#ifndef ENABLE_SMALL #define CHKACC_FILE (1 << 0)/**< Check for a file/directory presence */ #define CHKACC_DIRPATH (1 << 1)/**< Check for directory presence where a file should reside */
@@ -6243,7 +6244,7 @@print_default_gateway (M_INFO , &rgi, &rgi6);openvpn_exit (OPENVPN_EXIT_STATUS_GOOD );/* exit point */ } -#endif /* if defined(ENABLE_DEBUG) && !defined(ENABLE_SMALL) */ +#endif else if (streq(p[0], "echo") || streq(p[0], "parameter")) {struct buffer string =alloc_buf_gc (OPTION_PARM_SIZE , &gc);
src/openvpn/options.h +9 -9
@@ -133,16 +133,16 @@int tls_mtu;/* Maximum MTU for the control channel messages */ /* Advanced MTU negotiation and datagram fragmentation options */ -int mtu_discover_type;/* used if OS supports setting Path MTU discovery options on socket */ +int mtu_discover_type;/* used if OS supports setting Path MTU discovery options on socket */ -int fragment;/* internal fragmentation size */ -bool fragment_encap;/* true if --fragment had the "mtu" parameter to -* include overhead from IP and TCP/UDP encapsulation */ -int mssfix;/* Upper bound on TCP MSS */ -bool mssfix_default;/* true if --mssfix should use the default parameters */ -bool mssfix_encap;/* true if --mssfix had the "mtu" parameter to include -* overhead from IP and TCP/UDP encapsulation */ -bool mssfix_fixed;/* use the mssfix value without any encapsulation adjustments */ +int fragment;/* internal fragmentation size */ +bool fragment_encap;/* true if --fragment had the "mtu" parameter to +* include overhead from IP and TCP/UDP encapsulation */ +int mssfix;/* Upper bound on TCP MSS */ +bool mssfix_default;/* true if --mssfix should use the default parameters */ +bool mssfix_encap;/* true if --mssfix had the "mtu" parameter to include +* overhead from IP and TCP/UDP encapsulation */ +bool mssfix_fixed;/* use the mssfix value without any encapsulation adjustments */ int explicit_exit_notification;/* Explicitly tell peer when we are exiting via OCC_EXIT or [RESTART] message */
src/openvpn/options_util.c +7 -7
@@ -146,14 +146,14 @@return (int )i; } -static const char *updatable_options[] = {"block-ipv6" ,"block-outside-dns" , -"dhcp-option" ,"dns" , -"ifconfig" ,"ifconfig-ipv6" , +static const char *updatable_options[] = {"block-ipv6" ,"block-outside-dns" , +"dhcp-option" ,"dns" , +"ifconfig" ,"ifconfig-ipv6" ,"push-continuation" ,"redirect-gateway" , -"redirect-private" ,"route" , -"route-gateway" ,"route-ipv6" , -"route-metric" ,"topology" , -"tun-mtu" ,"keepalive" }; +"redirect-private" ,"route" , +"route-gateway" ,"route-ipv6" , +"route-metric" ,"topology" , +"tun-mtu" ,"keepalive" };bool check_push_update_option_flags (char *line,int *i,unsigned int *flags)
src/openvpn/run_command.h +9 -6
@@ -27,12 +27,15 @@#include "env_set.h" /* Script security */ -#define SSEC_NONE 0/* strictly no calling of external programs */ -#define SSEC_BUILT_IN 1/* only call built-in programs such as ifconfig, route, netsh, etc.*/ -#define SSEC_SCRIPTS 2/* allow calling of built-in programs and user-defined scripts */ -#define SSEC_PW_ENV \ - 3/* allow calling of built-in programs and user-defined scripts that may receive a password \ -as an environmental variable */ +/** strictly no calling of external programs */ +#define SSEC_NONE 0 +/** only call built-in programs such as ifconfig, route, netsh, etc.*/ +#define SSEC_BUILT_IN 1 +/** allow calling of built-in programs and user-defined scripts */ +#define SSEC_SCRIPTS 2 +/** allow calling of built-in programs and user-defined scripts that may receive a password +as an environmental variable */ +#define SSEC_PW_ENV 3#define OPENVPN_EXECVE_ERROR -1/* generic error while forking to run an external program */ #define OPENVPN_EXECVE_NOT_ALLOWED -2/* external program not run due to script security */
src/openvpn/ssl_common.h +9 -10
@@ -222,15 +222,15 @@*/ uint32_t peer_id; -struct key_state_ssl ks_ssl;/* contains SSL object and BIOs for the control channel */ +struct key_state_ssl ks_ssl;/* contains SSL object and BIOs for the control channel */ -time_t initial;/* when we created this session */ -time_t established;/* when our state went S_ACTIVE */ -time_t must_negotiate;/* key negotiation times out if not finished before this time */ -time_t must_die;/* this object is destroyed at this time */ -time_t peer_last_packet;/* Last time we received a packet in this control session */ +time_t initial;/* when we created this session */ +time_t established;/* when our state went S_ACTIVE */ +time_t must_negotiate;/* key negotiation times out if not finished before this time */ +time_t must_die;/* this object is destroyed at this time */ +time_t peer_last_packet;/* Last time we received a packet in this control session */ -int initial_opcode;/* our initial P_ opcode */ +int initial_opcode;/* our initial P_ opcode */ struct session_id session_id_remote;/* peer's random session ID */ struct link_socket_actual remote_addr;/* peer's IP addr */
@@ -579,9 +579,8 @@enum multi_status {CAS_NOT_CONNECTED , -CAS_WAITING_AUTH ,/**< Initial TLS connection established but deferred auth is not yet finished -*/ -CAS_PENDING ,/**< Options import (Connect script/plugin, ccd,...) */ +CAS_WAITING_AUTH ,/**< Initial TLS connection established but deferred auth is not yet finished */ +CAS_PENDING ,/**< Options import (Connect script/plugin, ccd,...) */ CAS_PENDING_DEFERRED ,/**< Waiting on an async option import handler */ CAS_PENDING_DEFERRED_PARTIAL ,/**< at least handler succeeded but another is still pending */ CAS_FAILED ,/**< Option import failed or explicitly denied the client */
src/openvpn/xkey_helper.c +2 -0
@@ -329,10 +329,12 @@#define MAKE_DI (x) { NID_##x, x, sizeof(x) } +/* clang-format off */ DIG_INFO dinfo[] = {MAKE_DI (sha1),MAKE_DI (sha256),MAKE_DI (sha384),MAKE_DI (sha512),MAKE_DI (sha224),MAKE_DI (sha512_224),MAKE_DI (sha512_256), {0 ,NULL ,0 } }; +/* clang-format on */ size_t out_len =0 ;bool ret = false;
src/tapctl/tap.c +6 -12
@@ -225,10 +225,8 @@ delete_device(_In_ HDEVINFO hDeviceInfoSet, _In_ PSP_DEVINFO_DATA pDeviceInfoData, _Inout_ LPBOOL pbRebootRequired) { -SP_REMOVEDEVICE_PARAMS params = - { - .ClassInstallHeader = - { +SP_REMOVEDEVICE_PARAMS params = { + .ClassInstallHeader = { .cbSize =sizeof (SP_CLASSINSTALL_HEADER ), .InstallFunction =DIF_REMOVE , },
@@ -281,10 +279,8 @@ change_device_state(_In_ HDEVINFO hDeviceInfoSet, _In_ PSP_DEVINFO_DATA pDeviceInfoData, _In_ BOOL bEnable, _Inout_ LPBOOL pbRebootRequired) { -SP_PROPCHANGE_PARAMS params = - { - .ClassInstallHeader = - { +SP_PROPCHANGE_PARAMS params = { + .ClassInstallHeader = { .cbSize =sizeof (SP_CLASSINSTALL_HEADER ), .InstallFunction =DIF_PROPERTYCHANGE , },
@@ -768,10 +764,8 @@if (dwResult !=ERROR_SUCCESS ) {/* The adapter was installed. But, the adapter ID was unobtainable. Clean-up. */ -SP_REMOVEDEVICE_PARAMS removedevice_params = - { - .ClassInstallHeader = - { +SP_REMOVEDEVICE_PARAMS removedevice_params = { + .ClassInstallHeader = { .cbSize =sizeof (SP_CLASSINSTALL_HEADER ), .InstallFunction =DIF_REMOVE , },
tests/unit_tests/openvpn/test_pkt.c +2 -2
@@ -219,7 +219,7 @@ {buf_reset_len (&buf);buf_write (&buf, client_reset_v2_tls_crypt,sizeof (client_reset_v2_tls_crypt)); -BPTR (&buf)[i] =0x23 ; + (BPTR (&buf))[i] =0x23 ; verdict =tls_pre_decrypt_lite (&tas, &state, &from, &buf);assert_int_equal (verdict,VERDICT_INVALID );free_tls_pre_decrypt_state (&state);
@@ -274,7 +274,7 @@free_tls_pre_decrypt_state (&state);/* flip a byte in the hmac */ -BPTR (&buf)[20 ] =0x23 ; + (BPTR (&buf))[20 ] =0x23 ; verdict =tls_pre_decrypt_lite (&tas, &state, &from, &buf);assert_int_equal (verdict,VERDICT_INVALID );free_tls_pre_decrypt_state (&state);
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1129?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ibd900adfc775b7f785f1d5630184a124f5d8ff4b
Gerrit-Change-Number: 1129
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-MessageType: merged